/**
 * $Id: init-deinit.h 4 2010-10-03 12:51:59Z pmedia@xi-intersection.net $
 */

// -----------------------------------------------------------------------------
// Constants
// -----------------------------------------------------------------------------

#define MAX_INPUT_BINDINGS 0xFFFF
#define MAX_INPUT_DEVICES  0xF

// -----------------------------------------------------------------------------
// Enumerations
// -----------------------------------------------------------------------------

/**
 * Those are the devices that could be parsed
 */

enum INPUT_DEVICES {
	DEVICE_UNKNOWN = 0,
	DEVICE_KEYBOARD,
	DEVICE_MOUSE,
	DEVICE_GAMEPAD1,
	DEVICE_GAMEPAD2
};

/**
 * Those are the values of the keybindings which represent the actions done
 * on that key press
 */

enum INPUT_FEEDBACK {
	FEEDBACK_UNKNOWN = 0,
	
	FEEDBACK_MOVE_FORWARD,
	FEEDBACK_MOVE_BACKWARD,
	
	FEEDBACK_ROTATE_LEFT,
	FEEDBACK_ROTATE_RIGHT,
	
	FEEDBACK_AIM_UP,
	FEEDBACK_AIM_DOWN,
	
	FEEDBACK_STRAFE_LEFT,
	FEEDBACK_STRAFE_RIGHT,
	
	FEEDBACK_SHOOT,
	FEEDBACK_JUMP,
	FEEDBACK_DASH,
	FEEDBACK_CROUCH, // Second Press => Morph Ball if available
	
	FEEDBACK_ITEMSELECT,
	FEEDBACK_ITEMCANCEL,
	
	FEEDBACK_AUTOAIM,
	
	FEEDBACK_MENU
};

// -----------------------------------------------------------------------------
// Structures
// -----------------------------------------------------------------------------

/**
 * Configuration Structure :: Input
 */

struct InputSettings {
	unsigned int bindings[MAX_INPUT_DEVICES][MAX_INPUT_BINDINGS];
};

/**
 * Configuration Structure :: Video
 */

struct VideoSettings {
	unsigned int   hRes;
	unsigned int   vRes;
	unsigned short depth;
	unsigned char  fullscreen:1;
	unsigned char  fpsLimit:1;
	unsigned char  detail;
};

/**
 * Configuration Structure :: Audio
 */

struct AudioSettings {
	unsigned int frequency;
	unsigned int channels;
	unsigned int musicVolume;
	unsigned int soundVolume;
};


// -----------------------------------------------------------------------------
// Global Variables
// -----------------------------------------------------------------------------

/**
 * Container of the video settings
 * 
 * @var struct videoSettings
 */

struct VideoSettings videoSettings;


// -----------------------------------------------------------------------------
// Functions
// -----------------------------------------------------------------------------

void init(int argc, char* argv[]);
void reinit(void);
void deinit(void);

void setDefaults(void);
void loadConfig(int argc, char *argv[]);
void loadConfigFile(char *file);
